home *** CD-ROM | disk | FTP | other *** search
/ SGI Hot Mix 17 / Hot Mix 17.iso / HM17_SGI / research / lib / get_screen_size.pro < prev    next >
Text File  |  1997-07-08  |  2KB  |  70 lines

  1. ; $Id: get_screen_size.pro,v 1.4 1997/03/11 21:43:45 griz Exp $
  2. ; Copyright (c) 1997, Research Systems, Inc. All rights reserved.
  3. ;       Unauthorized reproduction prohibited.
  4. ;
  5. ;+
  6. ;  FILE:
  7. ;       get_screen_size.pro
  8. ;
  9. ;  PURPOSE:
  10. ;       This application retrieves the screen size for the current
  11. ;       (or specified) display.   
  12. ;
  13. ;  CATEGORY:
  14. ;       Graphics
  15. ;
  16. ;  CONTENTS:
  17. ;       fun get_screen_size - retrieves the screen size
  18. ;
  19. ;  NAMED STRUCTURES:
  20. ;       none.
  21. ;
  22. ;  COMMON BLOCKS:
  23. ;       none.
  24. ;
  25. ;  MODIFICATION HISTORY:
  26. ;       10/96  DD - Original.
  27. ;       01/97  DD - Use an unmapped widget draw rather than a pixmap
  28. ;                   window because in some (rare) cases on certain X
  29. ;                   window configurations, a GL pixmap context cannot
  30. ;                   be supported.
  31. ;
  32. ;-  
  33. ; -----------------------------------------------------------------------------
  34. ;
  35. ; Purpose: Returns a two-element vector of the form [width, height] that
  36. ;          represents the dimensions, measured in device units, of the
  37. ;          screen.
  38. ;
  39. ;          X Only: The DISPLAY_NAME keyword may be set to a string 
  40. ;                  indicating the name of the X WIndows display
  41. ;                  that should be used to determine the screen size.
  42. FUNCTION get_screen_size, display_arg, DISPLAY_NAME=display_name
  43.  
  44.     ; Set default display name.
  45.     IF (N_ELEMENTS(display_arg) EQ 0) THEN BEGIN 
  46.         IF (N_ELEMENTS(display_name) EQ 0) THEN $
  47.             inDisplayName = "" $
  48.         ELSE $
  49.             inDisplayName = display_name
  50.     ENDIF ELSE $
  51.         inDisplayName = display_arg
  52.  
  53.     wBase = WIDGET_BASE(MAP=0)
  54.     wDraw = WIDGET_DRAW(wBase, XSIZE=10, YSIZE=10, GRAPHICS_LEVEL=2, $
  55.                         DISPLAY_NAME=inDisplayName)
  56.  
  57.     ; Create a small pixmap on the given display.
  58.     WIDGET_CONTROL, wBase, /REALIZE
  59.     WIDGET_CONTROL, wDraw, GET_VALUE=oWindow
  60.  
  61.     ; Retrieve the screen dimensions.
  62.     oWindow->GetProperty, SCREEN_DIMENSIONS=screenDims
  63.  
  64.     ; Clean up.
  65.     WIDGET_CONTROL, wBase, /DESTROY
  66.  
  67.     ; Return the screen dimensions.
  68.     RETURN, screenDims
  69. END